<template>
	<view class="content">
		<view class="btn-wrap">
			<kk-printer ref="kkprinter" :bufferData="bufferData" @onPrint="onPrint"></kk-printer>
		</view>
	</view>
</template>

<script>
	import util from '@/components/kk-printer/utils/util.js';
	import * as blesdk from '@/components/kk-printer/utils/bluetoolth.js';
	import kkPrinter from '@/components/kk-printer/index.vue';
	export default {
		data() {
			return {
				bufferData:''
			}
		},
		components:{
			kkPrinter
		},
		mounted() {
			
		},
		methods: {
			onPrint(opt){
				let strCmd =blesdk.CreatCPCLPage(560,640,1,0);  //标签范围
				strCmd += blesdk.addCPCLLine(0,300,560,300,3);	//下划线
				// strCmd += blesdk.addCPCLText(10,0,'4','3',0,'8.14');	
				// strCmd += blesdk.addCPCLBarCode(270,0,'128',80,0,1,1,'00051');	//条码
				// strCmd += blesdk.addCPCLText(290,80,'7','2',0,'00051');
				// strCmd += blesdk.addCPCLLocation(2);	//对齐
				strCmd += blesdk.addCPCLText(200,0,'24','5',0,'收件联');	//x（左边）y（上）z(字体)
				strCmd += blesdk.addCPCLText(300,0,'24','5',0,'沙田区');	//x（左边）y（上）z(字体)
				strCmd += blesdk.addCPCLLocation(0);	//对齐
				strCmd += blesdk.addCPCLText(20,60,'24','0',0,'揽收时间:');	//x（左边）y（上）z(字体)
				strCmd += blesdk.addCPCLText(180,60,'24','0',0,'2021/8/20 15:14');
				strCmd += blesdk.addCPCLText(20,100,'24','0',0,'收件人信息:');
				strCmd += blesdk.addCPCLText(180,100,'24','0',0,'VJ3054');
				strCmd += blesdk.addCPCLText(20,140,'24','0',0,'快递单号:');
				strCmd += blesdk.addCPCLText(180,140,'24','0',0,'S1252282018');
				strCmd += blesdk.addCPCLText(20,180,'24','0',0,'收件人姓名:');
				strCmd += blesdk.addCPCLText(180,180,'24','0',0,'胡欢');
				strCmd += blesdk.addCPCLText(20,220,'24','0',0,'收件人电话:');
				strCmd += blesdk.addCPCLText(180,220,'24','0',0,'18375696745');
				strCmd += blesdk.addCPCLText(20,260,'24','0',0,'地址:');
				strCmd += blesdk.addCPCLText(180,260,'24','0',0,'超过免仓期收取10HKD/天/件');
				// strCmd += blesdk.addCPCLSETMAG(0,0);
				strCmd += blesdk.addCPCLQRCode(380,50,'M', 2, 8, 'qr code test');		//二维码
				// strCmd += blesdk.addCPCLLocation(2);	//对齐
				strCmd += blesdk.addCPCLText(380,230,'7','2',0,'00051');
				strCmd += blesdk.addCPCLText(200,320,'24','5',0,'寄件联');	//x（左边）y（上）z(字体)
				strCmd += blesdk.addCPCLText(300,320,'24','5',0,'沙田区');	//x（左边）y（上）z(字体)
				strCmd += blesdk.addCPCLText(20,360,'24','0',0,'揽收时间:');	//x（左边）y（上）z(字体)
				strCmd += blesdk.addCPCLText(180,360,'24','0',0,'2021/8/20 15:14');
				strCmd += blesdk.addCPCLText(20,400,'24','0',0,'收件人信息:');
				strCmd += blesdk.addCPCLText(180,400,'24','0',0,'VJ3054');
				strCmd += blesdk.addCPCLText(20,440,'24','0',0,'快递单号:');
				strCmd += blesdk.addCPCLText(180,440,'24','0',0,'S1252282018');
				strCmd += blesdk.addCPCLText(20,480,'24','0',0,'收件人姓名:');
				strCmd += blesdk.addCPCLText(180,480,'24','0',0,'胡欢');
				strCmd += blesdk.addCPCLText(20,520,'24','0',0,'收件人电话:');
				strCmd += blesdk.addCPCLText(180,520,'24','0',0,'18375696745');
				strCmd += blesdk.addCPCLText(20,560,'24','0',0,'地址:');
				strCmd += blesdk.addCPCLText(180,560,'24','0',0,'超过免仓期收取10HKD/天/件');
				strCmd += blesdk.addCPCLQRCode(380,350,'M', 2, 8, 'qr code test');
				// strCmd += blesdk.addCPCLLocation(2);	//对齐
				strCmd += blesdk.addCPCLText(380,530,'7','2',0,'00051');
				// strCmd += blesdk.addCPCLSETMAG(2,2);
				// strCmd += blesdk.addCPCLText(40,150,'55','0',0,'无骨鸡爪 一盒（约1.5磅）');
				// strCmd += blesdk.addCPCLSETMAG(0,0);
				// strCmd += blesdk.addCPCLText(350,180,'7','2',0,'2019-08-12');
				// strCmd += blesdk.addCPCLLocation(2);
				// strCmd += blesdk.addCPCLQRCode(0,220,'M', 2, 6, 'qr code test');
				strCmd += blesdk.addCPCLPrint();
				console.log(strCmd,'查询')
				this.bufferData = strCmd;
			}
		}
	}
</script>

<style>
	.content {
		width: 100vw;
		height: 100vh;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
	.btn-wrap{
		width:180upx;
		height: 100upx;
		border-radius: 16upx;
		border: 2upx solid #333333;
		box-sizing: border-box;
		display: flex;
		justify-content: center;
		align-items: center;
	}
</style>
